import React from 'react'
import { NavBar, ProductCard, Tag, Button } from 'react-vant';
import { ArrowLeft } from '@react-vant/icons';
import { useHistory } from 'react-router-dom/cjs/react-router-dom.min';

export default function Mynav(props) {

    let { title, leftText } = props
    let history = useHistory()

    return (
        <div>
            <NavBar
                title={title}
                //leftText为true的时候 显示返回 否则不显示
                leftText={leftText ? "返回" : ''}
                //自定义左侧箭头
                leftArrow={leftText ? <ArrowLeft /> : null}
                onClickLeft={() => {
                    //返回到上一页
                    history.go(-1)
                }}
            />
        </div>
    )
}
